//
//  CSWCoverView.m
//  网易彩票
//
//  Created by MAC on 16/6/5.
//  Copyright © 2016年 MAC. All rights reserved.
//

#import "CSWCoverView.h"

@implementation CSWCoverView

+ (void)show{
    // 设置父控件的透明度会影响子控件
    
    CSWCoverView *cover = [[CSWCoverView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    
    cover.backgroundColor = [UIColor blackColor];
    
    cover.alpha = 0.3;
    
    // 获取主窗口
    [[UIApplication sharedApplication].keyWindow addSubview:cover];
}

+ (void)hide{
    //从窗口中移除  实现隐藏；
    for (UIView *childView in [UIApplication sharedApplication].keyWindow.subviews) {
        if ([childView isKindOfClass:self]) {
            [childView removeFromSuperview];
        }
    }
}

@end
